//
// CMaterialBase.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRefCount;
import org.ryzom.nel.misc.IStream;

public class CMaterialBase extends CRefCount {
  private long swigCPtr;

  public CMaterialBase(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CMaterialBase_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CMaterialBase obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CMaterialBase(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public CMaterialBase() {
    this(nel3dJNI.new_CMaterialBase(), true);
  }

  public void copyFromMaterial(CMaterial pMat) {
    nel3dJNI.CMaterialBase_copyFromMaterial(swigCPtr, this, CMaterial.getCPtr(pMat), pMat);
  }

  public void setName(String value) {
    nel3dJNI.CMaterialBase_Name_set(swigCPtr, this, value);
  }

  public String getName() {
    return nel3dJNI.CMaterialBase_Name_get(swigCPtr, this);
  }

  public void setDefaultAmbient(CTrackDefaultRGBA value) {
    nel3dJNI.CMaterialBase_DefaultAmbient_set(swigCPtr, this, CTrackDefaultRGBA.getCPtr(value), value);
  }

  public CTrackDefaultRGBA getDefaultAmbient() {
    return new CTrackDefaultRGBA(nel3dJNI.CMaterialBase_DefaultAmbient_get(swigCPtr, this), true);
  }

  public void setDefaultDiffuse(CTrackDefaultRGBA value) {
    nel3dJNI.CMaterialBase_DefaultDiffuse_set(swigCPtr, this, CTrackDefaultRGBA.getCPtr(value), value);
  }

  public CTrackDefaultRGBA getDefaultDiffuse() {
    return new CTrackDefaultRGBA(nel3dJNI.CMaterialBase_DefaultDiffuse_get(swigCPtr, this), true);
  }

  public void setDefaultSpecular(CTrackDefaultRGBA value) {
    nel3dJNI.CMaterialBase_DefaultSpecular_set(swigCPtr, this, CTrackDefaultRGBA.getCPtr(value), value);
  }

  public CTrackDefaultRGBA getDefaultSpecular() {
    return new CTrackDefaultRGBA(nel3dJNI.CMaterialBase_DefaultSpecular_get(swigCPtr, this), true);
  }

  public void setDefaultShininess(CTrackDefaultFloat value) {
    nel3dJNI.CMaterialBase_DefaultShininess_set(swigCPtr, this, CTrackDefaultFloat.getCPtr(value), value);
  }

  public CTrackDefaultFloat getDefaultShininess() {
    return new CTrackDefaultFloat(nel3dJNI.CMaterialBase_DefaultShininess_get(swigCPtr, this), true);
  }

  public void setDefaultEmissive(CTrackDefaultRGBA value) {
    nel3dJNI.CMaterialBase_DefaultEmissive_set(swigCPtr, this, CTrackDefaultRGBA.getCPtr(value), value);
  }

  public CTrackDefaultRGBA getDefaultEmissive() {
    return new CTrackDefaultRGBA(nel3dJNI.CMaterialBase_DefaultEmissive_get(swigCPtr, this), true);
  }

  public void setDefaultOpacity(CTrackDefaultFloat value) {
    nel3dJNI.CMaterialBase_DefaultOpacity_set(swigCPtr, this, CTrackDefaultFloat.getCPtr(value), value);
  }

  public CTrackDefaultFloat getDefaultOpacity() {
    return new CTrackDefaultFloat(nel3dJNI.CMaterialBase_DefaultOpacity_get(swigCPtr, this), true);
  }

  public void setDefaultTexture(CTrackDefaultInt value) {
    nel3dJNI.CMaterialBase_DefaultTexture_set(swigCPtr, this, CTrackDefaultInt.getCPtr(value), value);
  }

  public CTrackDefaultInt getDefaultTexture() {
    return new CTrackDefaultInt(nel3dJNI.CMaterialBase_DefaultTexture_get(swigCPtr, this), true);
  }

  public void setDefaultTexAnimTracks(SWIGTYPE_p_NL3D__CMaterialBase__CTexAnimTracks value) {
    nel3dJNI.CMaterialBase_DefaultTexAnimTracks_set(swigCPtr, this, SWIGTYPE_p_NL3D__CMaterialBase__CTexAnimTracks.getCPtr(value));
  }

  public SWIGTYPE_p_NL3D__CMaterialBase__CTexAnimTracks getDefaultTexAnimTracks() {
    long cPtr = nel3dJNI.CMaterialBase_DefaultTexAnimTracks_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NL3D__CMaterialBase__CTexAnimTracks(cPtr, false);
  }

  public void serial(IStream f) {
    nel3dJNI.CMaterialBase_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void setAnimatedTexture(long id, SWIGTYPE_p_CSmartPtrT_ITexture_t pText) {
    nel3dJNI.CMaterialBase_setAnimatedTexture(swigCPtr, this, id, SWIGTYPE_p_CSmartPtrT_ITexture_t.getCPtr(pText));
  }

  public boolean validAnimatedTexture(long id) {
    return nel3dJNI.CMaterialBase_validAnimatedTexture(swigCPtr, this, id);
  }

  public ITexture getAnimatedTexture(long id) {
    long cPtr = nel3dJNI.CMaterialBase_getAnimatedTexture(swigCPtr, this, id);
    return (cPtr == 0) ? null : new ITexture(cPtr, false);
  }

}
